<?php
/**
 * Created by PhpStorm.
 * User: zgh
 * Date: 2021-07-30
 * Time: 15:03
 */

namespace app\common\command;


use Cron\CronExpression;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;

//  */3 * * * *
class DemoCommand extends Command
{
    protected $_config = [
        'DELETE' => -1, //已经删除
        'DISABLED' => 0, //禁用
        'NORMAL' => 1, //正常
        'COMPLETED' => 2, // 完成
        'EXPIRED' => 3 // 过期
    ];

    protected function configure()
    {
        $this->setName('demo');
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln("success");
    }


    private function saveLog($type, $crontab_id, $title, $status, $remark = '')
    {
        $data['type'] = $type;
        $data['crontab_id'] = $crontab_id;
        $data['title'] = $title;
        $data['status'] = $status;
        $data['remark'] = $remark;
        $data['create_time'] = time();
        Db::name('crontab_log')->insert($data);
    }


}